Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pi-hole FTL v6.0 #2153

Merged
merged 2,631 commits into from
Feb 18, 2025
Merged

Pi-hole FTL v6.0 #2153

merged 2,631 commits into from
Feb 18, 2025

Conversation

PromoFaux
Copy link
Member

@PromoFaux PromoFaux commented Jan 6, 2025

What's Changed

New Contributors

Full Changelog: v5.25.2...v6.0

simonkelley and others added 30 commits December 2, 2024 19:40
When deriving a domain name from an IPv6 address, an address
such as 1234:: would become 1234--.example.com, which is
not legal in IDNA2008. Stop using the :: compression method,
so 1234:: becomes
1234-0000-0000-0000-0000-0000-0000-0000.example.com

Signed-off-by: DL6ER <[email protected]>
A bug in gentoo linux https://bugs.gentoo.org/945183 reported that dnsmasq 2.90 fails to compile with GCC 15.

The issue is that while previous versions of GCC defaulted to the C17 standard and C23 could be selected with
"-std=c23" or "-std=gnu23", GCC 15 defaults to C23. In C23 incompatible pointer types are an error instead of
a warning, so the "int (*callback)()" incomplete prototypes cause errors.

For example, compiling dnsmasq 2.90 with gcc 14.2.1 and "-std=gnu23" fails with errors such as:
    lease.c: In function `lease_find_interfaces':
    lease.c:467:34: warning: passing argument 3 of `iface_enumerate' from incompatible pointer type [-Wincompatible-pointer-types[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wincompatible-pointer-types]]
      467 |   iface_enumerate(AF_INET, &now, find_interface_v4);
          |                                  ^~~~~~~~~~~~~~~~~
          |                                  |
          |                                  int (*)(struct in_addr,  int,  char *, struct in_addr,  struct in_addr,  void *)
    In file included from lease.c:17:
    dnsmasq.h:1662:50: note: expected `int (*)(void)' but argument is of type `int (*)(struct in_addr,  int,  char *, struct in_addr,  struct in_addr,  void *)'
     1662 | int iface_enumerate(int family, void *parm, int (callback)());
          |                                             ~~~~~^~~~~~~~~~~

This patch uses a typedef'ed union of pointer types to get type checking of the pointers. If that's too complicated,
another way might be to use (void *) casts to disable type checking.

Also, some of the IPv6 callbacks had "int preferred, int valid" and some had
"unsigned int preferred, unsigned int valid". This patch changes them all to "unsigned int"
so they're the same and to avoid casting "u32" to "int", eg:
    u32 preferred = 0xffffffff;
    callback(..., (int)preferred, ...)
Even if those cast values aren't used in the callback, casting u32 to "int" feels bad, especially if "int" is 32 bits.

Signed-off-by: DL6ER <[email protected]>
This is not supported, and doesn't behave as one might expect.

Signed-off-by: DL6ER <[email protected]>
Signed-off-by: DL6ER <[email protected]>
…ing of dnsmasq ("extra" + protocol information)

Signed-off-by: DL6ER <[email protected]>
…all runtime of the dhcp-discover tool

Signed-off-by: DL6ER <[email protected]>
Signed-off-by: DL6ER <[email protected]>
Ommision broke DHCP relay on *BSD.

Signed-off-by: DL6ER <[email protected]>
This acts almost exactly like --dhcp-option except that the defined option
is only sent when replying to PXE clients. More importantly, these
options are sent in reply PXE clients when dnsmasq in acting in PXE
proxy mode. In PXE proxy mode, the set of options sent is defined by
the PXE standard and the normal set of options is not sent. This config
allows arbitrary options in PXE-proxy replies. A typical use-case is
to send option 175 to iPXE. Thanks to Jason Berry for finding the
requirement for this.

Signed-off-by: DL6ER <[email protected]>
When using PXE proxy-DHCP, dnsmasq supplies PXE information to
the client, which also talks to another "normal" DHCP server
for address allocation and similar. The normal DHCP server may
be on the local network, but it may also be remote, and accessed via
a DHCP relay. This change allows dnsmasq to act as both a
PXE proxy-DHCP server AND a DHCP relay for the same network.

Signed-off-by: DL6ER <[email protected]>
Remove duplicated code and silence a harmless warning
…. The current implementation mixed it in a harmless way, however, it is generating a warning in GCC 14 and up. Also, reduce code duplication

Signed-off-by: DL6ER <[email protected]>
Signed-off-by: DL6ER <[email protected]>
simonkelley and others added 17 commits February 8, 2025 06:53
A retry to upstream DNS servers triggered by the following conditions

1) A query asking for the same data as a previous query which has not yet been answered.
2) The second query arrives more than two seconds after the first.
3) Either the source of the second query or the id field differs from the first.

fails to set the case of the retry to the same pattern as the first attempt.

However dnsmasq expects the reply from upstream to have the case
pattern of the first attempt.

If the answer to the retry arrives before the answer to the first
query, dnsmasq will notice the case mismatch, log an error, and
ignore the answer.

The worst case scenario would be the first upstream query or reply is
lost and there would follow a short period where all queries for that
particular domain would fail.

This is a 2.91 development issue, it doesn't apply to previous stable releases.

Signed-off-by: DL6ER <[email protected]>
…possible detection (and startup prevention) of legit long-lived other processes like "pihole-FTL sqlite3", etc.

Signed-off-by: DL6ER <[email protected]>
…running duplicates don't interfere with each other. This can be seen as the fallback solution in case the PID file-based duplicate detection did not work due to security restrictions concerning process deetection on the system (see comment in function daemon.c:another_FTL() for further context)

Signed-off-by: DL6ER <[email protected]>
To complement the previous one, which fixed the retry path
when the query is retried from a different id/source address, this
fixes retries from the same id/source address.

Signed-off-by: DL6ER <[email protected]>
They should be equal, but that depends on untrusted data.

Signed-off-by: DL6ER <[email protected]>
… processes's state as the latter may not be allowed if the other process is running as another user and we don't have CAP_KILL (or am root)

Signed-off-by: DL6ER <[email protected]>
…dhcp-discover routine to prevent hanging threads from being able to cause the tool to stall forever

Signed-off-by: DL6ER <[email protected]>
Add proper timeout handling to dhcp-dicsover feature
@DL6ER DL6ER changed the title v6 placeholder Pi-hole FTL v6.0 Feb 18, 2025
DL6ER
DL6ER previously approved these changes Feb 18, 2025
yubiuser
yubiuser previously approved these changes Feb 18, 2025
@DL6ER DL6ER dismissed stale reviews from yubiuser and themself via 9319f37 February 18, 2025 15:55
yubiuser
yubiuser previously approved these changes Feb 18, 2025
@PromoFaux PromoFaux merged commit eaa7dbb into master Feb 18, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants